
$(function() {
	/*初始化数据表格*/
	$("#table_datagrid").datagrid({
		fit:true,
		fitColumns:true,
		toolbar:'#dg_tb',
		striped:true,
		singleSelect:true,
		pagination:true
	});
	
	$(":input[name='qo.supplierId']").combobox({
		width:140,
		panelHeight:null,
		editable:false
	});
	$(":input[name='qo.status']").combobox({
		width:140,
		panelHeight:null,
		editable:false
	});
	$(":input[name='qo.beginDate']").datebox({
		editable:false,
	}).datebox('calendar').calendar({
		validator:function(date) {
			var endDate = $(":input[name='qo.endDate']").val();
			if (endDate) {
				endDate = new Date(endDate);
				endDate.setHours(0);
				return date <= endDate && date <= new Date();
			} 
			return date <= new Date();
		}
	});
	$(":input[name='qo.endDate']").datebox({
		editable:false,
	}).datebox('calendar').calendar({
		validator:function(date) {
			var beginDate = $(":input[name='qo.beginDate']").val();
			if (beginDate) {
				beginDate = new Date(beginDate);
				beginDate.setHours(0);
				return date >= beginDate && date <= new Date();
			}
			return date <= new Date();
		}
	});
	
});

function edit() {
	var row = $("#table_datagrid").datagrid("getSelected");
	if (!row) {
		$.messager.alert('操作提示', '请选择需要编辑或查看的数据', 'info');
		return;
	}
	if (row.statusId == 0) {
		//进入编辑页面
		window.location.href = "/wms/orderBill_input.action?orderBill.id=" + row.id;
	} else {
		//进入查看页面
		window.location.href = "/wms/orderBill_show.action?orderBill.id=" + row.id;
	}
}




